<!--
 @Author: libing/makeup1122
 @Email: makeup1123@163.com
 @Date: "2020-02-28 23:49:48"
-->
<template>
  <v-container fluid>
    <v-tabs>
      <v-tab>被关注消息回复</v-tab>
      <v-tab>收到消息回复</v-tab>
      <v-tab>关键词回复</v-tab>
      <!-- <v-tab>服务器设置(development)</v-tab> -->
      <v-tab-item>
        <v-card flat>
          <v-card-text>
            <v-textarea filled v-model="sub.value"></v-textarea>
          </v-card-text>
          <v-card-actions>
            <v-spacer></v-spacer>
            <v-btn color="primary" @click="setValue(sub)">设置</v-btn>
            <v-spacer></v-spacer>
          </v-card-actions>
        </v-card>
      </v-tab-item>
      <v-tab-item>
        <v-card flat>
          <v-card-text>
            <v-radio-group v-model="auto.remark" row>
              <v-radio label="文本消息" value="text"></v-radio>
              <v-radio disabled label="图片消息" value="image"></v-radio>
              <v-radio disabled label="语言消息" value="audio"></v-radio>
              <v-radio disabled label="视频消息" value="video"></v-radio>
              <v-radio disabled label="音乐消息" value="music"></v-radio>
              <v-radio disabled label="图文消息" value="articles"></v-radio>
            </v-radio-group>
            <!-- <code></code> -->
            <v-textarea filled v-model="auto.value"></v-textarea>
          </v-card-text>
          <v-card-actions>
            <v-spacer></v-spacer>
            <v-btn color="primary" @click="setValue(auto)">设置</v-btn>
            <v-spacer></v-spacer>
          </v-card-actions>
        </v-card>
      </v-tab-item>
      <v-tab-item>
        <v-card flat>
          <v-card-text>
            <v-textarea filled v-model="sub.value"></v-textarea>
          </v-card-text>
          <v-card-actions>
            <v-spacer></v-spacer>
            <v-btn color="primary" @click="setValue(sub)">设置</v-btn>
            <v-spacer></v-spacer>
          </v-card-actions>
        </v-card>
      </v-tab-item>
      <!-- <v-tab-item></v-tab-item> -->
    </v-tabs>
  </v-container>
</template>
<script>
import { autoReply, autoReplySet } from '@/api/admin/wx.js'
export default {
  name: 'WXAutoReply',
  components: {},
  data: function () {
    return {
      sub: {},
      auto: {}
    }
  },
  created: function () {
    autoReply().then(res => {
      this.sub = res.data.wx_reply_sub || { name: 'wx_reply_sub', value: '' }
      this.auto = res.data.wx_reply_auto || { name: 'wx_reply_auto', value: '', remark: 'text' }
    })
  },
  computed: {},
  methods: {
    setValue: function(item) {
      autoReplySet(item).then(res => {
        this.$toasted.success(res.data)
      })
    }
  }
}
</script>
<style scoped>
</style>
